package com.draemon.haixiawenti.repository;

import com.yangzcp.userpojo.Shouchang;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * <p></p>
 *
 * @author  yangz
 * @date    2016/11/13
 * @version latest
 */
public interface ShouchangRepository extends JpaRepository<Shouchang, Integer>{

    @Query("from Shouchang where ref_users.sign=?1 order by create_time desc")
    public List<Shouchang> findUserShouchangList(String sign);

    @Query("from Shouchang where ref_tie.id=?1 and ref_users.sign=?2")
    public Shouchang findCond(Integer tieid, String sign);

    @Query("Select count(*) from Shouchang where ref_users.sign=?1")
    public int countUserShouchang(String sign);

    @Query("Select count(*) from Shouchang where ref_tie.id=?1")
    public int countTieShouchang(Integer tieid);

}
